package controllers

import (
	"github.com/astaxie/beego"
	//"strconv"
	"log"
)

type Api_userController struct {
	beego.Controller
}

type Sut_user struct { //
	Name  string
	Id    int
	Level int
}

func init() {

}

//beego.Router("/api/v1/user/?:id", &controllers.Api_userController{})
///api/v1/user时，取所有用户的值，有ID号时，取这个ID的值
func (this *Api_userController) Get() {
	var (
		u  Sut_user
		id int
		//id string
		//err error
	)
	u.Id = 1
	u.Level = 2
	u.Name = "xy"
	//id = this.GetString(":id", "")	//取字符串
	id, _ = this.GetInt(":id", 555) //取数字值
	log.Println("this.Ctx.Input.Param(':id'):", id)
	this.Data["json"] = u
	this.ServeJSON()
}
